-- SPDX-License-Identifier: GPL-3.0-or-later

local v_yongxing = fk.CreateSkill {
  name = "v_yongxing",
  tags = { Skill.Compulsory, },
}

v_yongxing:addEffect(fk.Damage, {
  --(非必要）赋予摸牌型技能定义
  anim_type = "drawcard",
  --触发条件：
  --存在触发时机的角色、触发时机的角色为遍历到的角色、遍历到的角色具有本技能、造成伤害的角色为遍历到的角色。
  can_trigger = function(self, event, target, player, data)
    return target and target == player and player:hasSkill(v_yongxing.name) and
      data.from == player and
      data.damage > 0
  end,
  on_trigger = function(self, event, target, player, data)
    for i = 1, data.damage do
      self:doCost(event, target, player, data)
    end
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(1, v_yongxing.name)
  end,
})

return v_yongxing